/*
 * GoldPiece.java
 * Implementation of the Gaijin Shogi Gold General Piece
 */
package shogi.pieces;

/**
 *
 * @author louis
 */
public class GoldPiece extends Piece {

    public GoldPiece(int index, String orientation) {
        super(index, 'g', orientation);
    }

    @Override
    public boolean isMoveLegal(int originalRow,
            int originalColumn, int destinationRow, int destinationColumn) {

        if ((originalRow == destinationRow) && (destinationColumn == (originalColumn + 1)
                || destinationColumn == (originalColumn - 1))) {
            return true;
        } else if ((originalColumn == destinationColumn) && (destinationRow == (originalRow + 1)
                || destinationRow == (originalRow - 1))) {
            return true;
        } else if ((this.getOrientation().equalsIgnoreCase("left")) && ((destinationColumn == (originalColumn + 1))
                && (destinationRow == (originalRow - 1) || destinationRow == (originalRow + 1)))) {
            return true;
        } else if ((this.getOrientation().equalsIgnoreCase("right")) && ((destinationColumn == (originalColumn - 1))
                && (destinationRow == (originalRow - 1) || destinationRow == (originalRow + 1)))) {
            return true;
        } else {
            return false;
        }

    }

    @Override
    public int getIntValue() {
        return 4;
    }
}
